package com.wuye.dao.impl;

import java.util.List;

import org.apache.ibatis.session.SqlSession;
import org.springframework.stereotype.Repository;

import com.wuye.common.dao.hibernate.BaseDaoHibernate;
import com.wuye.common.vo.CommonObjectVO;
import com.wuye.dao.ParkingTypeDao;
import com.wuye.entity.ParkingType;
import com.wuye.mapper.CommonMapper;
import com.wuye.util.MyBatisSessionFactory;

@Repository("parkingTypeDao")
public class ParkingTypeDaoImpl extends BaseDaoHibernate implements ParkingTypeDao
{
	public List<CommonObjectVO> getParkingTypes(int communityId) 
	{
		SqlSession session = null;
		List<CommonObjectVO> parkingTypes = null;
		
		try 
		{
			session = MyBatisSessionFactory.getSession();			
			CommonMapper commonMapper = session.getMapper(CommonMapper.class);
			parkingTypes = commonMapper.getParkingTypes(communityId);
		}
		catch (Exception e) 
		{
			e.printStackTrace();
		}
		finally
		{
			session.close();
		}
		
		return parkingTypes;
	}

	public ParkingType getParkingType(int parkingTypeId) 
	{
		return (ParkingType)super.getObject(ParkingType.class, parkingTypeId);
	}

}
